package rpc.provider.consumer;

import java.util.Random;

/**
 * @author: cuiyutian1
 * @date: 2021/9/4 13:51
 * @description:
 */
public class UserService {
    private int SUCCESS = 100;
    private int MAX = 100;

    public String userQuery(int id) {
        if(id < 0 || id > MAX){
            throw new RpcException(SoaErrorEnum.PARAM_ERROR);
        }
        Random random = new Random(1);
        int nextInt = random.nextInt();
        if(nextInt  < SUCCESS){
            return "success";
        }else {
            throw new RpcException(SoaErrorEnum.ERROR);
        }
    }
}

